#!/usr/bin/env node

const tool = require("./tool");
const getData = tool.getData;
const postData = tool.postData;
const serverURL = "http://localhost:8080";
const requirementApi = `${serverURL}/requirements`;
const projectApi = `${serverURL}/projects`;

async function getRequirements() {
  return getData(requirementApi);
}

async function getRequirementDetail(no) {
  return getData(`${requirementApi}/no/${no}`);
}

async function addRequirement(requirement) {
  return postData(requirementApi, requirement);
}

async function getProjects() {
  return getData(projectApi);
}

module.exports = {
  getRequirements,
  getRequirementDetail,
  addRequirement,
  getProjects
};
